package cn.openea.perpartner.cms.web.controller;

import cn.openea.perpartner.cms.web.dto.SupplementDto;
import cn.openea.perpartner.cms.web.service.ICmsSupplementService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import cn.openea.perpartner.common.core.web.controller.BaseController;
import cn.openea.perpartner.common.core.web.domain.AjaxResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

/**
 * @author Weird077
 * @description TODO
 * @date 2022-08-23 15:26
 */
@Api(tags = "商品辅表")
@Controller
@RequestMapping("supplement")
public class CmsSupplementController extends BaseController {
    @Autowired
    ICmsSupplementService supplementService;

    @ApiOperation("保存信息")
    @PostMapping("/save")
    @ResponseBody
    public AjaxResult save(@RequestBody SupplementDto supplementDto) {
        return supplementService.update(supplementDto)?success():error();
    }

    @ApiOperation("详情信息")
    @GetMapping("{customerId}")
    @ResponseBody
    public AjaxResult selectOne(@PathVariable String  customerId) {
        return success(supplementService.getByCustomerId(customerId));
    }
}
